{if session("index_user")['username'] == 'admin'}
<style>
    #CreateUsers a{
        display: block;
        width: 100%;
        height: 50px;
        background: grey;
        color: #fff;
        line-height: 50px;
        padding-left: 7px;
    }
    #CreateUsers img{
        width: 25px;
        height: 25px;
        border-radius: 50%;
    }
</style>

<div class="layui-row layui-col-space1" id="CreateUsers">
    <div   class="alert alert-success alert-with-border alert-dismissible" role="alert">
        <i class="ti-check m-r-10"></i>
        点击选择发布文章的用户:
    </div>
    <input type="hidden" name="post_uid" value="">
    <template v-for="(v,i) in list">
        <div class="layui-col-xs6 layui-col-sm2 layui-col-md2">
             <a @click="changeUser(v)" href="javascript:;" :class="'divUser'+v.id"> <img class="headimgurl" _src="{:config('web.cdn')}/static/images/loading.gif" :src="v.headimgurl" alt="" > {{v.nickname}}</a>
        </div>
    </template>
</div>


<br>

<script>


    var CreateUsers = new Vue({
        el: '#CreateUsers',
        data: {
            list:[]
        }
        ,methods: {
            changeUser:function (v) {
                console.log(v);
                $("input[name=post_uid]").val(v.id);
                var list = this.list;
                for (var i = 0; i < list.length ;i++){
                    $(".divUser"+list[i].id).css("background","grey")
                }
                $(".divUser"+v.id).css("background","#49A761")
            }
        },
        mounted:function(){
            //页面挂载需要运行的函数
        }
    })
    var url="{:url('Article/getusers')}";
    //$.ajaxSettings.async = false; //关闭异步
    $.post(url,{},function (e) {
        CreateUsers.list = e.data
        // $(".headimgurl").lazyload({
        //     effect: "fadeIn",
        // });
    })
</script>
{/if}